﻿#include "remotecontrol.h"

#include "television.h"

RemoteControl::RemoteControl(Television* tv) : WIterator()
{
    m_tv = tv;
    m_current = -1;
    m_total = tv->getTotalChannelNum();
}

void RemoteControl::first()
{
    m_current = 0;
}

void RemoteControl::last()
{
    m_current = m_total - 1;
}

void RemoteControl::current()
{
    m_tv->play(m_current);
}

void RemoteControl::next()
{
    m_current++;
}

bool RemoteControl::hasNext()
{
    return !(m_current == (m_total - 1));
}
